package cn.rht.study.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.Data;

@Data
public class JsonResult<T> {
	private static Logger log = LoggerFactory.getLogger(JsonResult.class);
	private Integer code;
	private String message;
	private T data;
	
	public JsonResult(){
		this.code = 200;
	}
	public JsonResult(Integer code) {
		this.code = code;
	}
	public JsonResult(Integer code,T data) {
		this.code = code;
		this.data = data;
		log.info("返回数据：" + data);
	}
	public JsonResult(Throwable e) {
		this.message = e.getMessage();
	}
}
